802d62d8: 27 bd ff c0  ADDIU sp, sp, 0xffffffc0 (-64)
802d62dc: af bf 00 24  SW ra, sp, 0x24 (36)
802d62e0: af a4 00 40  SW a0, sp, 0x40 (64)             arg1 === [sp + 0x40]
802d62e4: af a5 00 44  SW a1, sp, 0x44 (68)             arg2 === [sp + 0x44]
802d62e8: af a6 00 48  SW a2, sp, 0x48 (72)             arg3 === [sp + 0x48]
802d62ec: af a7 00 4c  SW a3, sp, 0x4c (76)             arg4 === [sp + 0x4c]
802d62f0: af b0 00 20  SW s0, sp, 0x20 (32)

802d62f4: a3 a0 00 3f  SB r0, sp, 0x3f (63)                 char [sp + 0x3f] = 0;
802d62f8: a3 a0 00 3e  SB r0, sp, 0x3e (62)                 char [sp + 0x3e] = 0;
802d62fc: a3 a0 00 3d  SB r0, sp, 0x3d (61)                 char [sp + 0x3d] = 0;
802d6300: af a0 00 38  SW r0, sp, 0x38 (56)                 [sp + 0x38] = 0;
802d6304: af a0 00 34  SW r0, sp, 0x34 (52)                 [sp + 0x34] = 0;
802d6308: af a0 00 30  SW r0, sp, 0x30 (48)                 [sp + 0x30] = 0;

802d630c: 3c 04 80 34  LUI a0, 0x8034 (32820)
802d6310: 8c 84 b4 94  LW a0, a0, 0xffffb494 (-19308)
802d6314: 0c 09 e3 16  JAL 0x80278c58 (-2144891816)     v0 = 0x80278c58(*(0x8033b494), 0x3c)
802d6318: 24 05 00 3c  ADDIU a1, r0, 0x3c (60)
802d631c: 3c 0e 80 33  LUI t6, 0x8033 (32819)
802d6320: 85 ce 13 60  LH t6, t6, 0x1360 (4960)         t6 = *(0x80331360)
802d6324: 3c 01 80 36  LUI at, 0x8036 (32822)           at = 0x80360000
802d6328: 00 40 80 25  OR s0, v0, r0                    s0 = v0
802d632c: 00 0e 78 80  SLL t7, t6, 0x2 (2)              t7 = *(0x80331360)*4
802d6330: 00 2f 08 21  ADDU at, at, t7                  at = 0x80360000 + *(0x80331360)*4
802d6334: 16 00 00 03  BNE s0, r0, 0x802d6344 (pc + 0xc)    if (0x80361320[*(0x80331360)] = 0x80278c58(*(0x8033b494), 0x3c)) goto 0x802d6344;
802d6338: ac 30 13 20  SW s0, at, 0x1320 (4896)         0x80361320[*(0x80331360)] = 0x80278c58(*(0x8033b494), 0x3c)

802d633c: 10 00 00 80  BEQ r0, r0, 0x802d6540 (pc + 0x200)  goto 0x802d6540;
802d6340: 00 00 00 00  NOP

802d6344: 3c 19 80 33  LUI t9, 0x8033 (32819)
802d6348: 87 39 13 60  LH t9, t9, 0x1360 (4960)         t9 = *(0x80331360)
802d634c: 3c 09 80 36  LUI t1, 0x8036 (32822)           t1 = 0x80360000
802d6350: 8f b8 00 40  LW t8, sp, 0x40 (64)             t8 = arg1
802d6354: 00 19 40 80  SLL t0, t9, 0x2 (2)              t0 = *(0x80331360)*4
802d6358: 01 28 48 21  ADDU t1, t1, t0                  t1 = 0x80360000 + *(0x80331360)*4
802d635c: 8d 29 13 20  LW t1, t1, 0x1320 (4896)         t1 = *(0x80361320 + *(0x80331360)*4)
802d6360: ad 38 00 00  SW t8, t1, 0x0 (0)                   *(0x80361320[*(0x80331360)]) = arg1;

802d6364: 3c 0b 80 33  LUI t3, 0x8033 (32819)
802d6368: 85 6b 13 60  LH t3, t3, 0x1360 (4960)         t3 = *(0x80331360)
802d636c: 3c 0d 80 36  LUI t5, 0x8036 (32822)           t5 = 0x80360000
802d6370: 8f aa 00 44  LW t2, sp, 0x44 (68)             t2 = arg2
802d6374: 00 0b 60 80  SLL t4, t3, 0x2 (2)              t4 = *(0x80331360)*4
802d6378: 01 ac 68 21  ADDU t5, t5, t4                  t5 = 0x80360000 + *(0x80331360)*4
802d637c: 8d ad 13 20  LW t5, t5, 0x1320 (4896)
802d6380: ad aa 00 04  SW t2, t5, 0x4 (4)                   *(0x80361320[*(0x80331360)] + 4) = arg2;

802d6384: 8f ae 00 48  LW t6, sp, 0x48 (72)             t6 = arg3
802d6388: 8f af 00 30  LW t7, sp, 0x30 (48)             t7 = [sp + 0x30]
802d638c: 01 cf c8 21  ADDU t9, t6, t7                  t9 = arg3 + [sp + 0x30]
802d6390: 83 28 00 00  LB t0, t9, 0x0 (0)               t0 = *(arg3 + [sp + 0x30])
802d6394: a3 a8 00 3f  SB t0, sp, 0x3f (63)                 [sp + 0x3f] = *(arg3 + [sp + 0x30]);

802d6398: 83 b8 00 3f  LB t8, sp, 0x3f (63)
802d639c: 13 00 00 59  BEQ r0, t8, 0x802d6504 (pc + 0x164)  if (![sp + 0x3f]) goto 0x802d6504;
802d63a0: 00 00 00 00  NOP

802d63a4: 83 a9 00 3f  LB t1, sp, 0x3f (63)
802d63a8: 24 01 00 25  ADDIU at, r0, 0x25 (37)
802d63ac: 15 21 00 3d  BNE t1, at, 0x802d64a4 (pc + 0xf4)   if ([sp + 0x3f] != '%') goto 0x802d64a4;
802d63b0: 00 00 00 00  NOP

802d63b4: 8f ab 00 30  LW t3, sp, 0x30 (48)
802d63b8: 25 6c 00 01  ADDIU t4, t3, 0x1 (1)
802d63bc: af ac 00 30  SW t4, sp, 0x30 (48)                 [sp + 0x30]++;

802d63c0: 8f a4 00 48  LW a0, sp, 0x48 (72)
802d63c4: 27 a5 00 30  ADDIU a1, sp, 0x30 (48)
802d63c8: 27 a6 00 3d  ADDIU a2, sp, 0x3d (61)
802d63cc: 0c 0b 58 51  JAL 0x802d6144 (-2144509628)         0x802d6144([sp + 0x48], &[sp + 0x30], &[sp + 0x3d], &[sp + 0x3e]);
802d63d0: 27 a7 00 3e  ADDIU a3, sp, 0x3e (62)

802d63d4: 8f aa 00 48  LW t2, sp, 0x48 (72)             t2 = arg3
802d63d8: 8f ad 00 30  LW t5, sp, 0x30 (48)             t5 = [sp + 0x30]
802d63dc: 24 01 00 64  ADDIU at, r0, 0x64 (100)         at = 'd'
802d63e0: 01 4d 70 21  ADDU t6, t2, t5                  t6 = [sp + 0x30] + arg3
802d63e4: 81 cf 00 00  LB t7, t6, 0x0 (0)               t7 = arg3[[sp + 0x30]]
802d63e8: 11 e1 00 06  BEQ at, t7, 0x802d6404 (pc + 0x18) if (arg3[[sp + 0x30]] == 'd') goto 0x802d6404;
802d63ec: 00 00 00 00  NOP

802d63f0: 24 01 00 78  ADDIU at, r0, 0x78 (120)
802d63f4: 11 e1 00 03  BEQ at, t7, 0x802d6404 (pc + 0xc)    if (arg3[[sp + 0x30]] == 'x' || arg3[[sp + 0x30]] == 'd') goto 0x802d6404;
802d63f8: 00 00 00 00  NOP

802d63fc: 10 00 00 41  BEQ r0, r0, 0x802d6504 (pc + 0x104)  goto 0x802d6504;
802d6400: 00 00 00 00  NOP

802d6404: 8f b9 00 48  LW t9, sp, 0x48 (72)             t9 = arg3
802d6408: 8f a8 00 30  LW t0, sp, 0x30 (48)             t0 = [sp + 0x30]
802d640c: 24 01 00 64  ADDIU at, r0, 0x64 (100)         at = 100
802d6410: 03 28 c0 21  ADDU t8, t9, t0                  
802d6414: 83 09 00 00  LB t1, t8, 0x0 (0)               t1 = arg3[[sp + 0x30]]
802d6418: 15 21 00 03  BNE t1, at, 0x802d6428 (pc + 0xc)    if (arg3[[sp + 0x30]] != 'd') goto 0x802d6428;
802d641c: 00 00 00 00  NOP

802d6420: 24 0b 00 0a  ADDIU t3, r0, 0xa (10)
802d6424: af ab 00 38  SW t3, sp, 0x38 (56)                 [sp + 0x38] = 10;

802d6428: 8f ac 00 48  LW t4, sp, 0x48 (72)
802d642c: 8f aa 00 30  LW t2, sp, 0x30 (48)
802d6430: 24 01 00 78  ADDIU at, r0, 0x78 (120)
802d6434: 01 8a 68 21  ADDU t5, t4, t2
802d6438: 81 ae 00 00  LB t6, t5, 0x0 (0)
802d643c: 15 c1 00 03  BNE t6, at, 0x802d644c (pc + 0xc)    if (arg3[[sp + 0x30]] != 'x') goto 0x802d644c;
802d6440: 00 00 00 00  NOP

802d6444: 24 0f 00 10  ADDIU t7, r0, 0x10 (16)
802d6448: af af 00 38  SW t7, sp, 0x38 (56)                 [sp + 0x38] = 16;

802d644c: 8f b9 00 30  LW t9, sp, 0x30 (48)
802d6450: 27 28 00 01  ADDIU t0, t9, 0x1 (1)
802d6454: af a8 00 30  SW t0, sp, 0x30 (48)                 [sp + 0x30]++;

802d6458: 3c 18 80 33  LUI t8, 0x8033 (32819)
802d645c: 87 18 13 60  LH t8, t8, 0x1360 (4960)         t8 = *(0x80331360)
802d6460: 3c 0b 80 36  LUI t3, 0x8036 (32822)           t3 = 0x80360000
802d6464: 8f ac 00 34  LW t4, sp, 0x34 (52)             t4 = [sp + 0x34]
802d6468: 00 18 48 80  SLL t1, t8, 0x2 (2)              t1 = *(0x80331360)*4
802d646c: 01 69 58 21  ADDU t3, t3, t1                  t3 = 0x80360000 + *(0x80331360)*4
802d6470: 8d 6b 13 20  LW t3, t3, 0x1320 (4896)         t3 = *(0x80361320[*(0x80331360)])
802d6474: 93 aa 00 3d  LBU t2, sp, 0x3d (61)            t2 = [sp + 0x3d]
802d6478: 83 ad 00 3e  LB t5, sp, 0x3e (62)             t5 = [sp + 0x3e]
802d647c: 01 6c 30 21  ADDU a2, t3, t4                  a2 = *(0x80361320[*(0x80331360)]) + [sp + 0x34]
802d6480: 24 c6 00 0a  ADDIU a2, a2, 0xa (10)           a2 = *(0x80361320[*(0x80331360)]) + [sp + 0x34] + 10
802d6484: 8f a4 00 4c  LW a0, sp, 0x4c (76)             a0 = [sp + 0x4c]
802d6488: 8f a5 00 38  LW a1, sp, 0x38 (56)             a1 = [sp + 0x38]
802d648c: 27 a7 00 34  ADDIU a3, sp, 0x34 (52)          a3 = &[sp + 0x34]
802d6490: af aa 00 10  SW t2, sp, 0x10 (16)
802d6494: 0c 0b 57 95  JAL 0x802d5e54 (-2144510380)         0x802d5e54([sp + 0x4c], [sp + 0x38], *(0x80361320[*(0x80331360)]) + [sp + 0x34] + 10, &[sp + 0x34], [sp + 0x3d], [sp + 0x3e]);
802d6498: af ad 00 14  SW t5, sp, 0x14 (20)

802d649c: 10 00 00 11  BEQ r0, r0, 0x802d64e4 (pc + 0x44)   goto 0x802d64e4;
802d64a0: 00 00 00 00  NOP

802d64a4: 3c 0f 80 33  LUI t7, 0x8033 (32819)
802d64a8: 85 ef 13 60  LH t7, t7, 0x1360 (4960)
802d64ac: 3c 08 80 36  LUI t0, 0x8036 (32822)
802d64b0: 8f b8 00 34  LW t8, sp, 0x34 (52)
802d64b4: 00 0f c8 80  SLL t9, t7, 0x2 (2)              t9 = *(0x80331360)*4
802d64b8: 01 19 40 21  ADDU t0, t0, t9                  t0 = 0x80360000 + *(0x80331360)*4
802d64bc: 8d 08 13 20  LW t0, t0, 0x1320 (4896)         t0 = *(0x80361320[*(0x80331360)])
802d64c0: 83 ae 00 3f  LB t6, sp, 0x3f (63)
802d64c4: 01 18 48 21  ADDU t1, t0, t8                  t1 = *(0x80361320[*(0x80331360)]) + [sp + 0x34]
802d64c8: a1 2e 00 0a  SB t6, t1, 0xa (10)                  *(*(0x80361320[*(0x80331360)]) + [sp + 0x34] + 10) = [sp + 0x3f];

802d64cc: 8f ab 00 34  LW t3, sp, 0x34 (52)
802d64d0: 25 6c 00 01  ADDIU t4, t3, 0x1 (1)
802d64d4: af ac 00 34  SW t4, sp, 0x34 (52)                 [sp + 0x34]++;

802d64d8: 8f aa 00 30  LW t2, sp, 0x30 (48)
802d64dc: 25 4d 00 01  ADDIU t5, t2, 0x1 (1)
802d64e0: af ad 00 30  SW t5, sp, 0x30 (48)                 [sp + 0x30]++;

802d64e4: 8f af 00 48  LW t7, sp, 0x48 (72)
802d64e8: 8f b9 00 30  LW t9, sp, 0x30 (48)
802d64ec: 01 f9 40 21  ADDU t0, t7, t9                  t0 = arg3 + [sp + 0x30]
802d64f0: 81 18 00 00  LB t8, t0, 0x0 (0)
802d64f4: a3 b8 00 3f  SB t8, sp, 0x3f (63)                 [sp + 0x3f] = arg3[[sp + 0x30]];

802d64f8: 83 ae 00 3f  LB t6, sp, 0x3f (63)
802d64fc: 15 c0 ff a9  BNE t6, r0, 0x802d63a4 (pc - 0x15c)  if ([sp + 0x3f]) goto 0x802d63a4;
802d6500: 00 00 00 00  NOP

802d6504: 3c 0b 80 33  LUI t3, 0x8033 (32819)
802d6508: 85 6b 13 60  LH t3, t3, 0x1360 (4960)         t3 = *(0x80331360)
802d650c: 3c 0a 80 36  LUI t2, 0x8036 (32822)
802d6510: 8f a9 00 34  LW t1, sp, 0x34 (52)             t1 = [sp + 0x34]
802d6514: 00 0b 60 80  SLL t4, t3, 0x2 (2)              t4 = *(0x80331360)*4
802d6518: 01 4c 50 21  ADDU t2, t2, t4                  t2 = 0x80360000 + *(0x80331360)*4
802d651c: 8d 4a 13 20  LW t2, t2, 0x1320 (4896)         t2 = 0x80361320[*(0x80331360)]
802d6520: a5 49 00 08  SH t1, t2, 0x8 (8)                   *(0x80361320[*(0x80331360)]) + 8 = [sp + 0x34];

802d6524: 3c 0d 80 33  LUI t5, 0x8033 (32819)
802d6528: 85 ad 13 60  LH t5, t5, 0x1360 (4960)         t5 = *(0x80331360)
802d652c: 3c 01 80 33  LUI at, 0x8033 (32819)
802d6530: 25 af 00 01  ADDIU t7, t5, 0x1 (1)
802d6534: a4 2f 13 60  SH t7, at, 0x1360 (4960)             *(0x80331360)++

802d6538: 10 00 00 01  BEQ r0, r0, 0x802d6540 (pc + 0x4)
802d653c: 00 00 00 00  NOP
802d6540: 8f bf 00 24  LW ra, sp, 0x24 (36)
802d6544: 8f b0 00 20  LW s0, sp, 0x20 (32)
802d6548: 27 bd 00 40  ADDIU sp, sp, 0x40 (64)
802d654c: 03 e0 00 08  JR ra
802d6550: 00 00 00 00  NOP



char [sp + 0x3f] = 0;
char [sp + 0x3e] = 0;
char [sp + 0x3d] = 0;
[sp + 0x38] = 0;
[sp + 0x34] = 0;
[sp + 0x30] = 0;
if (0x80361320[*(0x80331360)] = 0x80278c58(*(0x8033b494), 0x3c)) goto 0x802d6344;
goto 0x802d6540;
0802d6344:
*(0x80361320[*(0x80331360)]) = arg1;
*(0x80361320[*(0x80331360)] + 4) = arg2;
[sp + 0x3f] = *(arg3 + [sp + 0x30]);
if (![sp + 0x3f]) goto 0x802d6504;
802d63a4:
if ([sp + 0x3f] != '%') goto 0x802d64a4;
[sp + 0x30]++;
0x802d6144([sp + 0x48], &[sp + 0x30], &[sp + 0x3d], &[sp + 0x3e]);
if (arg3[[sp + 0x30]] == 'x' || arg3[[sp + 0x30]] == 'd') goto 0x802d6404;
goto 0x802d6504;
802d6404:
if (arg3[[sp + 0x30]] != 'd') goto 0x802d6428;
[sp + 0x38] = 10;
802d6428:
if (arg3[[sp + 0x30]] != 'x') goto 0x802d644c;
[sp + 0x38] = 16;
802d644c:
[sp + 0x30]++;
0x802d5e54([sp + 0x4c], [sp + 0x38], *(0x80361320[*(0x80331360)]) + [sp + 0x34] + 10, &[sp + 0x34], [sp + 0x3d], [sp + 0x3e]);
goto 0x802d64e4;
802d64a4:
*(*(0x80361320[*(0x80331360)]) + [sp + 0x34] + 10) = [sp + 0x3f];
[sp + 0x34]++;
[sp + 0x30]++;
802d64e4:
[sp + 0x3f] = arg3[[sp + 0x30]];
if ([sp + 0x3f]) goto 0x802d63a4;
802d6504:
*(0x80361320[*(0x80331360)] + 8) = [sp + 0x34];
*(0x80331360)++
802d6540:

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

typedef struct tagMYS_STR_INFO {
    /*    4 @ 0x00 */ int x;
    /*    4 @ 0x04 */ int y;
    /*    2 @ 0x08 */ short len;
    /* 0x34 @ 0x0a */ char str[0x34];  /* NB: size conjected */
} MYS_STR_INFO;

extern MYS_STR_INFO * mys_str_ptr_array[];   /* 0x80361320 */
extern short num_mys_strs;                   /* 0x80331360 */

void printf_like_dbg_function(int x, int y, char *fmt, int n)    /* 0x802d62d8 */
{
    char c /* [sp + 0x3f] */ = 0;
    char [sp + 0x3e] = 0;
    unsigned char [sp + 0x3d] = 0;
    int radix /* [sp + 0x38] */ = 0;
    int j /* [sp + 0x34] */ = 0;
    int i /* [sp + 0x30] */ = 0;
    
    if (!(mys_str_ptr_array[num_mys_strs] = 0x80278c58(*(0x8033b494), 0x3c))) {   /* allocates memory? */
        return;
    }
    mys_str_ptr_array[num_mys_strs]->x = x;
    mys_str_ptr_array[num_mys_strs]->y = y;
    while (c = fmt[i]) {
        if (c == '%') {
            i++;
            0x802d6144(fmt, &i, &[sp + 0x3d], &[sp + 0x3e]);
            if (fmt[i] != 'x' && fmt[i] != 'd') {
                break;
            } else if (fmt[i] == 'd') {
                radix = 10;
            } else if (fmt[i] == 'x') {
                radix = 16;
            }
            i++;
            0x802d5e54(n, radix, &(mys_str_ptr_array[num_mys_strs]->str[j]), &j, [sp + 0x3d], [sp + 0x3e]);
        } else {
            mys_str_ptr_array[num_mys_strs]->str[j] = c;
            j++;
            i++;
        }
    }
    mys_str_ptr_array[num_mys_strs]->len = j;
    num_mys_strs++
}
